const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    type:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
  onShow:function(){
    var that = this
    wx.getStorage({
      key: 'openid',
      success: function (res) {
        let openid = res.data
        wx.request({
          url: app.globalData.URL + '/app/complaints/index?type=0&openid=' + openid,
          success: function (res) {
            console.log(res)
            that.setData({
              list: res.data.com,
              type: res.data.type
            })
          }
        })
      },
    })
  },

  toComplaint:function(){
    wx.navigateTo({
      url: '../complaint/complaint',
    })
  },
  toFeedback:function(){
    wx.navigateTo({
      url: '../feedback/feedback',
    })
  },
  toDetail:function(e){
    var that = this
    var id = e.id
    // if(that.type == '0'){
    //   wx.navigateTo({
    //     url: '../complaint/complaint?id=id',
    //   })
    // }else{
    //   wx.navigateTo({
    //     url: '../feedback/feedback?id=id',
    //   })
    // }
  }
})